home *** CD-ROM | disk | FTP | other *** search
- package sun.print;
-
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.print.DocFlavor;
- import javax.print.attribute.AttributeSet;
- import javax.print.attribute.standard.Copies;
- import javax.print.attribute.standard.CopiesSupported;
- import javax.print.attribute.standard.SheetCollate;
- import javax.swing.BorderFactory;
- import javax.swing.JCheckBox;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JSpinner;
- import javax.swing.SpinnerNumberModel;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
-
- class ServiceDialog$CopiesPanel extends JPanel implements ActionListener, ChangeListener {
- private final String strTitle;
- private SpinnerNumberModel snModel;
- private JSpinner spinCopies;
- private JLabel lblCopies;
- private JCheckBox cbCollate;
- private boolean scSupported;
- // $FF: synthetic field
- final ServiceDialog this$0;
-
- public ServiceDialog$CopiesPanel(ServiceDialog var1) {
- this.this$0 = var1;
- this.strTitle = ServiceDialog.getMsg("border.copies");
- GridBagLayout var2 = new GridBagLayout();
- GridBagConstraints var3 = new GridBagConstraints();
- this.setLayout(var2);
- this.setBorder(BorderFactory.createTitledBorder(this.strTitle));
- var3.fill = 2;
- var3.insets = ServiceDialog.access$700();
- this.lblCopies = new JLabel(ServiceDialog.getMsg("label.numcopies"), 11);
- this.lblCopies.setDisplayedMnemonic(ServiceDialog.access$800("label.numcopies"));
- this.lblCopies.getAccessibleContext().setAccessibleName(ServiceDialog.getMsg("label.numcopies"));
- ServiceDialog.access$300(this.lblCopies, this, var2, var3);
- this.snModel = new SpinnerNumberModel(1, 1, 999, 1);
- this.spinCopies = new JSpinner(this.snModel);
- this.lblCopies.setLabelFor(this.spinCopies);
- ((JSpinner.NumberEditor)this.spinCopies.getEditor()).getTextField().setColumns(3);
- this.spinCopies.addChangeListener(this);
- var3.gridwidth = 0;
- ServiceDialog.access$300(this.spinCopies, this, var2, var3);
- this.cbCollate = ServiceDialog.access$1000("checkbox.collate", this);
- this.cbCollate.setEnabled(false);
- ServiceDialog.access$300(this.cbCollate, this, var2, var3);
- }
-
- public void actionPerformed(ActionEvent var1) {
- if (this.cbCollate.isSelected()) {
- ServiceDialog.access$1200(this.this$0).add(SheetCollate.COLLATED);
- } else {
- ServiceDialog.access$1200(this.this$0).add(SheetCollate.UNCOLLATED);
- }
-
- }
-
- public void stateChanged(ChangeEvent var1) {
- this.updateCollateCB();
- ServiceDialog.access$1200(this.this$0).add(new Copies(this.snModel.getNumber().intValue()));
- }
-
- private void updateCollateCB() {
- int var1 = this.snModel.getNumber().intValue();
- if (ServiceDialog.access$1500(this.this$0)) {
- this.cbCollate.setEnabled(true);
- } else {
- this.cbCollate.setEnabled(var1 > 1 && this.scSupported);
- }
-
- }
-
- public void updateInfo() {
- Class var1 = Copies.class;
- Class var2 = CopiesSupported.class;
- Class var3 = SheetCollate.class;
- boolean var4 = false;
- this.scSupported = false;
- if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var1)) {
- var4 = true;
- }
-
- CopiesSupported var5 = (CopiesSupported)ServiceDialog.access$400(this.this$0).getSupportedAttributeValues(var1, (DocFlavor)null, (AttributeSet)null);
- if (var5 == null) {
- var5 = new CopiesSupported(1, 999);
- }
-
- Copies var6 = (Copies)ServiceDialog.access$1200(this.this$0).get(var1);
- if (var6 == null) {
- var6 = (Copies)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var1);
- if (var6 == null) {
- var6 = new Copies(1);
- }
- }
-
- this.spinCopies.setEnabled(var4);
- this.lblCopies.setEnabled(var4);
- int[][] var7 = var5.getMembers();
- int var8;
- int var9;
- if (var7.length > 0 && var7[0].length > 0) {
- var8 = var7[0][0];
- var9 = var7[0][1];
- } else {
- var8 = 1;
- var9 = Integer.MAX_VALUE;
- }
-
- this.snModel.setMinimum(new Integer(var8));
- this.snModel.setMaximum(new Integer(var9));
- int var10 = var6.getValue();
- if (var10 < var8 || var10 > var9) {
- var10 = var8;
- }
-
- this.snModel.setValue(new Integer(var10));
- if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var3)) {
- this.scSupported = true;
- }
-
- SheetCollate var11 = (SheetCollate)ServiceDialog.access$1200(this.this$0).get(var3);
- if (var11 == null) {
- var11 = (SheetCollate)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var3);
- if (var11 == null) {
- var11 = SheetCollate.UNCOLLATED;
- }
- }
-
- this.cbCollate.setSelected(var11 == SheetCollate.COLLATED);
- this.updateCollateCB();
- }
- }
-